
import { UIManager } from "../../ui/UIManager";
import { UIView } from "../../ui/UIView";

const { ccclass, property } = cc._decorator;

@ccclass
export default class TipView extends UIView {

    @property(cc.Label)
    label: cc.Label = null;
    @property(cc.Node)
    body: cc.Node = null;
    onOpen(text) {
        this.label.string = text;
        cc.Tween.stopAllByTarget(this.body);
        this.body.opacity = 0;
        this.body.y = 0;
        cc.tween(this.body).by(0.5, { opacity: 255, y: 80 }).delay(0.5).by(0.5, { opacity: -255, y: 70 })
            .call(() => {
                UIManager.instance.close(this);
            }).start();

    }
}
